package com.ruoyi.wechat.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wechat.domain.Evaluate;
import com.ruoyi.wechat.service.IEvaluateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/wechat/evaluate")
public class WxEvaluateController extends BaseController {
    @Autowired
    private IEvaluateService evaluateService;
    /**
     * 新增营地评价
     */
    @PostMapping("wxadd")
    public AjaxResult add(@RequestBody Evaluate evaluate){
        return toAjax(evaluateService.insertEvaluate(evaluate));
    }
    /**
     * 查询营地评价列表
     */
    @GetMapping("/wxlist")
    public AjaxResult list(Evaluate evaluate){
        List<Evaluate> list=evaluateService.selectEvaluateList(evaluate);
        return success(list);
    }
    /**
     * 获取营地评价详细信息
     */
    @GetMapping(value = "/wxgetInfo/{evaluateId}")
    public  AjaxResult getInfo(@PathVariable("evaluateId") String evaluateId){
        return success(evaluateService.selectEvaluateByEvaluateId(evaluateId));
    }
    /**
     * 删除营地评价
     */
    @DeleteMapping("/delete/{evaluateId}")
    public AjaxResult remove(@PathVariable String evaluateId){
        return toAjax(evaluateService.deleteEvaluateByEvaluateId(evaluateId));
    }

}
